package windowBuilderExample;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.JRadioButton;
import javax.swing.JToggleButton;
import javax.swing.JPanel;
import javax.swing.JCheckBox;
import javax.swing.JFormattedTextField;
import javax.swing.JTextPane;
import javax.swing.JTextArea;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.CardLayout;
import javax.swing.JTextField;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import java.awt.Dimension;
import javax.swing.BoxLayout;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.factories.FormFactory;

public class UiExampleSecondLayoutManager {

	private JFrame frame;
	private JPanel topPanel;
	private JPanel topNorthPanel;
	private JPanel secondRowPanel;
	private JPanel thirdRowPanel;
	private JLabel lblNewLabel;
	private JLabel lblNewLabel_1;
	private JPanel thirdRowCenterPanel;
	private JTextField textField_1;
	private JPanel topCenterPanel;
	private JPanel topCenter_WestPanel;
	private JLabel lblNewLabel_2;
	private JPanel topCenter_CenterPanel;
	private JTextArea textArea;
	private JPanel topCenter_CenterSouthPanel;
	private JButton btnNewButton;
	private JPanel firstRowPanel;
	private JLabel lblRegistrationForm;
	private JPanel firstRowCenterPanel;
	private JTextField textField;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					UiExampleSecondLayoutManager window = new UiExampleSecondLayoutManager();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public UiExampleSecondLayoutManager() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(new BorderLayout(0, 0));
		
		topPanel = new JPanel();
		frame.getContentPane().add(topPanel, BorderLayout.CENTER);
		topPanel.setLayout(new BorderLayout(0, 0));
		
		topNorthPanel = new JPanel();
		topNorthPanel.setPreferredSize(new Dimension(10, 90));
		topPanel.add(topNorthPanel, BorderLayout.NORTH);
		topNorthPanel.setLayout(new GridLayout(0, 1, 0, 0));
		
		firstRowPanel = new JPanel();
		topNorthPanel.add(firstRowPanel);
		
		lblRegistrationForm = new JLabel("Registration Form");
		firstRowPanel.add(lblRegistrationForm);
		
		secondRowPanel = new JPanel();
		topNorthPanel.add(secondRowPanel);
		secondRowPanel.setLayout(new BorderLayout(0, 0));
		
		lblNewLabel = new JLabel(" Name");
		lblNewLabel.setPreferredSize(new Dimension(80, 15));
		secondRowPanel.add(lblNewLabel, BorderLayout.WEST);
		
		firstRowCenterPanel = new JPanel();
		FlowLayout fl_firstRowCenterPanel = (FlowLayout) firstRowCenterPanel.getLayout();
		fl_firstRowCenterPanel.setAlignment(FlowLayout.LEFT);
		secondRowPanel.add(firstRowCenterPanel, BorderLayout.CENTER);
		
		textField = new JTextField();
		firstRowCenterPanel.add(textField);
		textField.setColumns(10);
		
		thirdRowPanel = new JPanel();
		topNorthPanel.add(thirdRowPanel);
		thirdRowPanel.setLayout(new BorderLayout(0, 0));
		
		lblNewLabel_1 = new JLabel(" Age");
		lblNewLabel_1.setPreferredSize(new Dimension(80, 15));
		thirdRowPanel.add(lblNewLabel_1, BorderLayout.WEST);
		
		thirdRowCenterPanel = new JPanel();
		thirdRowPanel.add(thirdRowCenterPanel, BorderLayout.CENTER);
		thirdRowCenterPanel.setLayout(new FlowLayout(FlowLayout.LEADING, 5, 5));
		
		textField_1 = new JTextField();
		textField_1.setPreferredSize(new Dimension(6, 20));
		thirdRowCenterPanel.add(textField_1);
		textField_1.setColumns(10);
		
		topCenterPanel = new JPanel();
		topPanel.add(topCenterPanel, BorderLayout.CENTER);
		topCenterPanel.setLayout(new BorderLayout(0, 0));
		
		topCenter_WestPanel = new JPanel();
		FlowLayout fl_topCenter_WestPanel = (FlowLayout) topCenter_WestPanel.getLayout();
		fl_topCenter_WestPanel.setAlignment(FlowLayout.LEFT);
		topCenter_WestPanel.setPreferredSize(new Dimension(80, 10));
		topCenterPanel.add(topCenter_WestPanel, BorderLayout.WEST);
		
		lblNewLabel_2 = new JLabel("Comment");
		topCenter_WestPanel.add(lblNewLabel_2);
		
		topCenter_CenterPanel = new JPanel();
		topCenterPanel.add(topCenter_CenterPanel, BorderLayout.CENTER);
		topCenter_CenterPanel.setLayout(new BorderLayout(0, 0));
		
		textArea = new JTextArea();
		topCenter_CenterPanel.add(textArea, BorderLayout.CENTER);
		
		topCenter_CenterSouthPanel = new JPanel();
		topCenter_CenterPanel.add(topCenter_CenterSouthPanel, BorderLayout.SOUTH);
		
		btnNewButton = new JButton("Ok");
		topCenter_CenterSouthPanel.add(btnNewButton);
	}  
}
